<template>
  <el-container style="min-height: 100vh">
    <el-aside
      :width="sideWidth + 'px'"
      style="background-color: #333;"
    >
			<SliderBar class="sidebar-container"/>
    </el-aside>
    <el-container>
      <el-header style="border-bottom: 1px solid #ccc">
        <NavBar/>
      </el-header>
      <el-main>
        <pageLayout />
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
import pageLayout from "./components/pageLayout.vue";
import SliderBar from "./components/sliderBar/index.vue";
import NavBar from "./components/NavBar/index.vue";
export default {
  name: "Layouts",
  components: {
    pageLayout,
		SliderBar,
    NavBar
  },
  data() {
    return {
      collapseBtnClass: "el-icon-s-fold",
      isCollapse: false,
      sideWidth: 200,
      logoTextShow: true,
      user: {},
    };
  },
  created() {
    //从后台获取最新的User数据
    this.getUser();
  },
  methods: {
    collapse() {
      //点击收缩按钮触发
      console.log("点击收缩按钮触发");
      this.isCollapse = !this.isCollapse;
      if (this.isCollapse) {
        //收缩
        this.sideWidth = 64;
        this.collapseBtnClass = "el-icon-s-unfold";
        this.logoTextShow = false;
      } else {
        //展开
        this.sideWidth = 200;
        this.collapseBtnClass = "el-icon-s-fold";
        this.logoTextShow = true;
      }
    },
    getUser() {
			console.log('从后台获取User数据')
      // let username = localStorage.getItem("user") ? JSON.parse(localStorage.getItem("user")).username : "";
      //从后台获取User数据
      this.user = {};
    },
  },
};
</script>